package com.huangpuweb.task.service.imp;

import com.huangpuweb.task.model.LxmReXian;
import com.huangpuweb.task.model.SysXiaoGongCheng;
import com.huangpuweb.task.service.LaoXiMenApiService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Administrator
 */
@Service
public class LaoXiMenApiServiceImpl extends BaseLaoXiMenDataServiceImp implements LaoXiMenApiService {

    @Override
    public void insertXiaoGongCheng(SysXiaoGongCheng xc) {
        String sql="insert into sys_xiaogongcheng(january,february,march,apr,may,june,july,august,september,october,november,december," +
                "_id,state,refuse_text,prj_name,prj_addr,prj_area,prj_price,demand_com,construction_com,prj_state,check_depart," +
                "check_person,check_content,check_question,check_question_desp,change_state,change_desp,change_pictures,prj_property," +
                "prj_lease_contract,prj_con_contract,prj_license,prj_certifications,prj_manager_cert,prj_safe_cert,prj_manager_appiontment," +
                "prj_safe_appiontment,prj_design_cert,prj_assist_org,prj_person_name,prj_person_phone,prj_type,userid,updateTime,__v," +
                "prj_grid,picture,location,prj_depart,start_date) " +
                "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
        update(sql,new Object[]{xc.getJanuary(),xc.getFebruary(),xc.getMarch(),xc.getApr(),xc.getMay(),xc.getJune(),xc.getJuly(),
        xc.getAugust(),xc.getSeptember(),xc.getOctober(),xc.getNovember(),xc.getDecember(),xc.get_id(),xc.getState(),
        xc.getRefuse_text(),xc.getPrj_name(),xc.getPrj_addr(),xc.getPrj_area(),xc.getPrj_price(),xc.getDemand_com(),xc.getConstruction_com(),
                xc.getPrj_state(),xc.getCheck_depart(),xc.getCheck_person(),xc.getCheck_content(),xc.getCheck_question(),xc.getCheck_question_desp(),
                xc.getChange_state(),xc.getChange_desp(),xc.getChange_pictures(),xc.getPrj_property(),xc.getPrj_lease_contract(),xc.getPrj_con_contract(),
                xc.getPrj_license(),xc.getPrj_certifications(),xc.getPrj_manager_cert(),xc.getPrj_safe_cert(),xc.getPrj_manager_appiontment(),
                xc.getPrj_safe_appiontment(),xc.getPrj_design_cert(),xc.getPrj_assist_org(),xc.getPrj_person_name(),xc.getPrj_person_phone(),
                xc.getPrj_type(),xc.getUserid(),xc.getUpdateTime(),xc.get__v(),xc.getPrj_grid(),xc.getPicture(),xc.getLocation(),xc.getPrj_depart(),xc.getStart_date()});

    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void truncateGongChengTable() {
        String sql="truncate table sys_xiaogongcheng";
        update(sql,new Object[]{});
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void truncateTable() {
        String sql="truncate table sys_rexian_data";
        update(sql,new Object[]{});
    }

    @Override
    public void insertReXianData(LxmReXian s) {
        String sql="insert into sys_rexian_data (ID,AJZT,RWH,FXSJ,WTLX,Street,JuWei,FSDZ,SQLXR,LXFS,WTMS,ZZBM,SJZZBM,JASJ,FKJL,MYQK,CQQK,DBQK,ObjectEntryState,NotMappedProperties)" +
                "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
        update(sql,new Object[]{s.getID(),s.getAJZT(),s.getRWH(),s.getFXSJ(),s.getWTLX(),s.getStreet(),
        s.getJuWei(),s.getFSDZ(),s.getSQLXR(),s.getLXFS(),s.getWTMS(),s.getZZBM(),s.getSJZZBM(),s.getJASJ(),
        s.getFKJL(),s.getMYQK(),s.getCQQK(),s.getDBQK(),s.getObjectEntryState(),s.getNotMappedProperties()});
    }
}
